<?php

namespace tool;

use OSS\Core\OssException;
use OSS\OssClient;

class Price
{
    private $price_list;
    function __construct($_price_list=[])
    {
        $this->price_list=$_price_list;
    }

    public function changeprice($price,$text,$buynumber=1){
        $_price=intval($price*$buynumber*100);
        $this->price_list[]=['price'=>$_price,'text'=>$text];
    }
    public function getprice_list(){
        return $this->price_list;
    }

    public function gettotalprice(){
        $price_list=$this->price_list;
        $totalprice=0;
        for($i=0;$i<count($price_list);$i++){
            $totalprice+=$price_list[$i]['price'];
        }
        return $totalprice/100;
    }

}